<template>
  <div>
    <div class="logo">
      <span>青梧商城</span>
      <el-button
        type="info"
        style="float: right; margin-right: 30px"
        @click="outLogin"
        >退出</el-button
      >
    </div>
    <el-container>
      <el-menu
        default-active="2"
        class="el-menu-vertical-demo"
        background-color="#000"
        text-color="#fff"
        active-text-color="#ffd04b"
        style="width: 200px; height: 800px"
        router
      >
        <el-submenu>
          <template slot="title">
            <i class="el-icon-user"></i>
            <span>{{ menus[0].name }}</span>
          </template>
          <el-menu-item-group>
            <el-menu-item :index="users[0].link">{{
              users[0].name
            }}</el-menu-item>
          </el-menu-item-group>
          <el-submenu
            :index="index1.toString()"
            v-for="(item1, index1) in usersList"
            :key="index1"
          >
            <template slot="title">{{ item1.name }}</template>
            <el-menu-item
              :index="item2.link"
              v-for="(item2, index2) in item1.children"
              :key="index2"
              >{{ item2.name }}</el-menu-item
            >
          </el-submenu>
        </el-submenu>

        <el-submenu
          :index="index.toString()"
          v-for="(item, index) in bottomList"
          :key="index"
        >
          <template slot="title">
            <i class="el-icon-location"></i>
            <span>{{ item.name }}</span>
          </template>
          <el-menu-item-group
            v-for="(item1, index1) in item.children"
            :key="index1"
          >
            <el-menu-item :index="item1.link">{{ item1.name }}</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
      </el-menu>
      <el-main>
        <router-view style="margin: 10px 10px"></router-view>
      </el-main>
    </el-container>
  </div>
</template>

<script>
export default {
  data() {
    return {
      shu: [],
      frist: {},
      nei: [],
    };
  },
  created() {
    this.http.get("http://pc.qingwuit.com/api/Admin/menus").then((res) => {
      console.log(res.data.data);
      // this.shu = res.data.data[0].children.silce(0,1)
      this.nei = res.data.data[0].children.slice(0, 1);
      this.shu = res.data.data.slice(0, 1);
      this.san = res.data.data[0].children.slice(1, 5);
      // console.log(this.nei);
      console.log(this.san);
    });
  },
  methods: {
    handleOpen(key, keyPath) {
      // console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      // console.log(key, keyPath);
    },
  },
};
</script>

<style lang="scss" scoped>
* {
  margin: 0;
  padding: 0;
}
.tou {
  width: 199px;
  height: 100%;
  background-color: #545c64;
}
.tou1 {
  text-align: center;
  width: 108px;
  height: 100%;
  background-color: #e9eef3;
}
.el-header {
  display: flex;
  justify-content: space-between;
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  line-height: 60px;
}

.el-aside {
  background-color: #000;
  color: #fff;
  text-align: center;
  line-height: 200px;
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  line-height: 160px;
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
</style>